# -*- coding: utf-8 -*-
# @Author  : Adolf  Frank
# @Time    : 2021-12-28 13:35
# Flask服务封装
from flask import Flask
import os

from src.db_es.ElasticSearchClass import ElasticSearchClass
import src.db_es.es_config as Config
from src.intelligent_interaction.engine.semantic_search import SemanticSearch

app = Flask(__name__)
app.config.from_object('config')
root_path=os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
print(root_path)

# 长链接该为每次查询进行链接，避免长时间不使用连接自动断开
#es_service_conn = ElasticSearchClass(Config.ONLINE_ES_HOST, Config.ONLINE_ES_PORT, "", "")
# es_service_conn = ElasticSearchClass(Config.TEST_ONLINE_ES_HOST, Config.TEST_ONLINE_ES_PORT
#                                      ,Config.TEST_ONLINE_ES_USER, Config.TEST_ONLINE_ES_PASSWORD)
# es_service_conn = ElasticSearchClass(Config.PRODUCT_ONLINE_ES_HOST, Config.PRODUCT_ONLINE_ES_PORT
#                                , Config.PRODUCT_ONLINE_ES_USER, Config.PRODUCT_ONLINE_ES_PASSWORD)

#semantic_faq = SemanticSearch(es_service_conn)


# Mysql
# from database.mysql_api import MysqlAPI
# from database import db_config
# service_conn = MysqlAPI(db_config.mysql_ip, db_config.mysql_port, db_config.mysql_user,
#                        db_config.mysql_pwd, db_config.mysql_db)


from app import index
from app import semantic_client


